﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TntOrm.Structures
{
    [Serializable]
    public class TableMapping
    {
        private string _TableName = string.Empty;
        private List<FieldMapping> _Fields = new List<FieldMapping>( );

        private Dictionary< string, TntOrm.Attributes.OrmCrossReference > _CrossReferences
            = new Dictionary<string,TntOrm.Attributes.OrmCrossReference>( );

        public Dictionary< string, TntOrm.Attributes.OrmCrossReference > CrossReferences
        {
            get { return _CrossReferences; }
            set { _CrossReferences = value; }
        }

        public string TableName
        {
            get {  return _TableName; }
            set { _TableName = value; }
        }

        public List<FieldMapping> Fields
        {
            get { return _Fields; }
            set { _Fields = value; }
        }

        private string _TableTitle;

        public string TableTitle
        {
            get { return _TableTitle; }
            set { _TableTitle = value; }
        }

        private bool _InMenu;

        public bool InMenu
        {
            get { return _InMenu; }
            set { _InMenu = value; }
        }

        private Type _TableType;

        public Type Type
        {
            get { return _TableType; }
            set { _TableType = value; }
        }

        public TableMapping( string TableName, string Title, bool IsInMenu, Type TableType )
        {
            this._TableName = TableName;
            this._TableTitle = Title;
            this._InMenu = IsInMenu;
            this._TableType = TableType;
        }

        public void AddField( FieldMapping NewField )
        {
            _Fields.Add( NewField );
        }
    }
}